/**
* 版权所有：福建邮科电信业务部厦门研发中心 
*====================================================
* 文件名称: BeanInfo.java
* 修订记录：
* No    日期				作者(操作:具体内容)
* 1.    2013-3-29			詹保山(创建:创建文件)
*====================================================
* 类描述：(说明未实现或其它不应生成javadoc的内容)
* 
*/
package com.devframe.gc.meta;

import java.util.List;


public class ZBSGCBeanInfoMeta {
	
	
	private Class targetClazz;
	
	private String clazzFullName;
	
	private String clazzName;
	
	/**
	 * 实体的名称 类名首字母小写
	 */
	private String entityName;
	/**
	 * 生成文件存放的文件夹,model 所在的包名
	 */
	private String folderName;
	/**
	 * 包名
	 */
	private String packageName;
	
	//
	private List<FieldMeta> beanFieldList;
	
	private IdFieldMeta idField;
	
	private String getIdFieldMethodName;
	
	private String setIdFieldMethodName;
	
	
	
	
	
	public ZBSGCBeanInfoMeta(Class targetClazz){
		this.targetClazz=targetClazz;
		this.clazzFullName=this.targetClazz.getName();
		this.clazzName=this.targetClazz.getSimpleName();
		this.entityName=this.clazzName.substring(0, 1).toLowerCase()+this.clazzName.substring(1);
		this.packageName=this.targetClazz.getPackage().getName();
		this.folderName=this.packageName.substring(this.packageName.lastIndexOf(".")+1);
		
		
		
		
	}





	public Class getTargetClazz() {
		return targetClazz;
	}

	public String getClazzFullName() {
		return clazzFullName;
	}

	public String getClazzName() {
		return clazzName;
	}

	public String getEntityName() {
		return entityName;
	}

	public String getFolderName() {
		return folderName;
	}


	public String getPackageName() {
		return packageName;
	}





	public List<FieldMeta> getBeanFieldList() {
		return beanFieldList;
	}
	
	public void addBeanField(FieldMeta meta){
		if(beanFieldList.size()==0){
			this.beanFieldList.add(meta);
		}else{
			//需要进行排序
			int i=0;
			for(;i<this.beanFieldList.size();i++){
				FieldMeta item=this.beanFieldList.get(i);
				if(item.getOrderNum()>meta.getOrderNum()){
					this.beanFieldList.add(i, meta);
					break;
				}
			}
			if(i==this.beanFieldList.size()){
				this.beanFieldList.add(meta);
			}
			
		}
	}





	public void setBeanFieldList(List<FieldMeta> beanFieldList) {
		this.beanFieldList = beanFieldList;
	}





	public IdFieldMeta getIdField() {
		return idField;
	}





	public void setIdField(IdFieldMeta idField) {
		this.idField = idField;
	}





 

	public String getGetIdFieldMethodName() {
		if(this.getIdFieldMethodName==null || "".equals(this.getIdFieldMethodName)){
			this.getIdFieldMethodName="get"+this.idField.getFieldName().substring(0, 1).toUpperCase()+this.idField.getFieldName().substring(1);
		}
		return getIdFieldMethodName;
	}


	public void setGetIdFieldMethodName(String getIdFieldMethodName) {
		this.getIdFieldMethodName = getIdFieldMethodName;
	}


	public String getSetIdFieldMethodName() {
		if(this.setIdFieldMethodName==null || "".equals(this.setIdFieldMethodName)){
			this.setIdFieldMethodName="set"+this.idField.getFieldName().substring(0, 1).toUpperCase()+this.idField.getFieldName().substring(1);
		}
		return setIdFieldMethodName;
	}


	public void setSetIdFieldMethodName(String setIdFieldMethodName) {
		this.setIdFieldMethodName = setIdFieldMethodName;
	}
	

}
